<?php 
/**
 *   Joomdiet - administrator/components/views/food/tmpl/default.php
 *   Author: Juan Dapena Paz (juan@bittingbits.com)
 *   Copyright (C) 2010 Bitting Bits S.L.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">

<table> <tr>
       </tr>
   </table>
<td align="left" width="100%">
</td>
<td nowrap="nowrap">
    <?php echo $this->lists['catid']; ?>
    <?php echo $this->lists['typeid']; ?>
    <?php echo $this->lists['state']; ?>
</td>

<div id="editcell">
    <table class="adminlist">
    <thead>
        <tr>
        	<th width="10">
						<?php echo JText::_( 'Num' ); ?>
					</th>
            <th width="5">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
            </th>

           <th width="1"><?php echo JHTML::_( 'grid.sort', 'Id', 'id', $this->lists['order_Dir'], $this->lists['order']); ?></th>
           

            <th width="1"><?php echo JHTML::_( 'grid.sort', JText::_('COUNTRY'), 'country', $this->lists['order_Dir'], $this->lists['order']); ?></th>
            

            <th width="120"><?php echo JHTML::_( 'grid.sort', JText::_('TYPE'), 'type', $this->lists['order_Dir'], $this->lists['order']); ?></th>

             <th width="50">
            	<?php echo JText::_('LOGO'); ?>
            </th>

            <th><?php echo JHTML::_( 'grid.sort', JText::_('COM_BBITSSD_TITLE'), 'title', $this->lists['order_Dir'], $this->lists['order']); ?></th>
            
             <th width="8%"><?php echo JHTML::_( 'grid.sort', JText::_('COM_BBITSSD_DATEADDED'), 'checked_out_time', $this->lists['order_Dir'], $this->lists['order']); ?></th>
            
             <th width="70"><?php echo JHTML::_( 'grid.sort', JText::_('PUBLISHED'), 'published', $this->lists['order_Dir'], $this->lists['order']); ?></th>
            
            <th width="4" align="center">
            <?php echo JHTML::_( 'grid.sort', JText::_('HITS'), 'hits', $this->lists['order_Dir'], $this->lists['order']); ?>
            </th>
            <?php if (($this->catid!=0) AND ($this->typeid!=0)): ?>
            <th width="8%">
	<?php echo JHTML::_('grid.sort',   'Position', 'ordering', $this->lists['order_Dir'], $this->lists['order'] ); ?>

	<?php echo JHTML::_('grid.order',  $this->items ); ?>
</th>
            <?php endif; ?>
            
            <th>
            	<?php echo JText::_('EDIT'); ?>
            </th>

        </tr>
    </thead>
    <tfoot>
        <tr>
        	<?php if (($this->catid!=0) AND ($this->typeid!=0)): ?>
            <td colspan="13"><?php echo $this->pagination->getListFooter(); ?></td>
            <?php else: ?>
            <td colspan="11"><?php echo $this->pagination->getListFooter(); ?></td>
            <?php endif; ?>
        </tr>
    </tfoot>
    <tbody>
        <?php
        	$k = 0;
			for ($i=0, $n=count($this->items); $i < $n; $i++) {
        	$row = $this->items[$i];
    		
			$checked 	= JHTML::_('grid.checkedout',   $row, $i );
			$access 	= JHTML::_('grid.access',   $row, $i );
			$published 	= JHTML::_('grid.published', $row, $i );
            $checked = JHTML::_('grid.id', $i, $row->id); 
            
            ?>
            
            
            <tr class="<?php echo 'row'.$k; ?>">
            
            	<td>
						<?php echo $this->pagination->getRowOffset( $i ); ?>
					</td>
            
                <td>
                    <?php echo $checked; ?>
                </td>
                <td>
                    <?php echo $row->id; ?>
                </td>
                
                <td>
                
                	
                 <?php if((isset($row->country_data->flag)!='')): ?>
                	<a href="index.php?option=com_bbitsd&controller=countries&task=editCountry&cid[]=<?php echo $row->country_data->id; ?>">
                 
                	<img src="<?php echo JURI::base(); ?>/components/com_bbitsd/assets/flags/<?php echo $row->country_data->flag;?>.png" />
					
					</a>                
                <?php else:?>
                -		
                		
                <?php endif;?>
                </td>
                
                <td>
               	<?php if((isset($row->type_data->title)!='')): ?>
                	<a href="index.php?option=com_bbitsd&controller=types&task=editType&cid[]=<?php echo $row->type_data->id; ?>">
                		<?php echo $row->type_data->title; ?>
                	</a>
                <?php endif;?>
                </td>
				
	
				
				<td>
					<?php if($row->image!=''): ?>
					<img src="<?php echo JURI::base(); ?>/components/com_bbitsd/assets/uploads/<?php echo $row->image;?>" height="30px"/>

					
					<?php else: ?>
					-
					<?php endif; ?>
					
				</td>
					                
                <td>
					<strong><a href="index.php?option=com_bbitsd&controller=items&task=editItem&cid[]=<?php echo $row->id; ?>"><?php echo $row->title; ?></a></strong>
                </td>
                			<td align="center">
     	<?php
     	echo JFactory::getDate($row->checked_out_time)->toFormat('%a %d %b %Y')
     	?>          			
                     	
                     </td>
                     
                   <td align="center">
            <?php echo $published ?>
</td>  
                     
                <td>
                	<?php echo $row->hits; ?>
                </td>
                
                <?php if (($this->catid!=0) AND ($this->typeid!=0)): ?>
 <td class="order">
	<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" />
</td>
                <?php endif; ?>
				<td>
					<a href="index.php?option=com_bbitsd&controller=items&task=editItem&cid[]=<?php echo $row->id; ?>"><?php echo JText::_('EDIT'); ?></a>
				</td>
            </tr>
        <?php $k = 1 - $k;  } ?>
    </tbody>
    </table>
</div>
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
<input type="hidden" name="option" value="com_bbitsd" />
<input type="hidden" name="task" value="items" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="items" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
